﻿using Castle.DynamicProxy;
using Janus.Cores.DynamicProxy.CastleDynamic.Interception;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Janus.Cores.Application
{
    public class AppRuntime
    {
        public static List<IInterceptor> Interceptors { get; }

        static AppRuntime()
        {
            Interceptors = new List<IInterceptor>();
            //增加具体拦截器
            Interceptors.Add(new ExceptionHandlingInterceptor());
        }

        /// <summary>
        /// 应用程序初始化
        /// </summary>
        public static void Init()
        {
            var assemblyDal = ServiceFactory.LoadSQLServerDAL();
            ServiceFactory.Register(assemblyDal);
            var assemblyServices = ServiceFactory.LoadServices();
            ServiceFactory.Register(assemblyServices);
        }
    }
}
